home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS01.ADF
/
ABasicStuff
/
Graphics
/
ThreeDee.bas
< prev
next >
Wrap
BASIC Source File
|
1985-12-04
|
2KB
|
45 lines
290 scnclr:PRINT TAB(14);"3-D plots":PRINT
300 REM INPUT PARAMETERS
310 PRINT : INPUT "Grid width: 10"; A$: IF A$="" THEN GW=10:GOTO 330
320 GW = VAL(A$)
330 INPUT "Accuracy (1-fine,10-poor): 10";A$:IF A$="" THEN AC=10: GOTO 350
340 AC=VAL(A$)
350 C=SQR(2)/2:GOSUB 470: OX=120: OY=32
360 scnclr : screen 0,4,0
370 REM BEGIN ITERATIONS
380 FOR X=XU TO XL STEP -GW*XM:GOSUB 610
390 FOR Y=YL TO YU STEP AC*YM:GOSUB 640:GOSUB 700:NEXT:Y=YU:GOSUB 640:GOSUB 700:NEXT
400 X=XL:GOSUB 610: FOR Y=YL TO YU STEP AC*YM:GOSUB 640:GOSUB 700:NEXT
410 FOR Y=YL TO YU STEP GW*YM: GOSUB 620
420 FOR X=XL TO XU STEP AC*XM:K=(X+TX)/XM*C
430 GOSUB 640:GOSUB 700:NEXT:K=(XU+TX)/XM*C:GOSUB 640:GOSUB 700:NEXT
440 Y=YU:GOSUB 620: FOR X=XL TO XU STEP AC*XM:K=(X+TX)/XM*C:GOSUB 640:GOSUB 700:NEXT
445 get a$ : if a$="" then goto 445
450 STOP
460 REM INPUT PARAMETERS
470 INPUT "X min:-4";A$: IF A$="" THEN XL=-4: GOTO 490
480 XL=VAL(A$)
490 INPUT "Y min:-4";A$: IF A$="" THEN YL=-4: GOTO 510
500 YL=VAL(A$)
510 INPUT "X max: 4";A$:IF A$="" THEN XU=4: GOTO 530
520 XU=VAL(A$)
530 INPUT "Y max: 4";A$: IF A$ = "" THEN YU=4 :GOTO 550
540 YU=VAL(A$)
550 INPUT "Z max: 2";A$: IF A$="" THEN ZU= 2: GOTO 570
560 ZU=VAL(A$)
570 INPUT "Z min:-2";A$:IF A$="" THEN ZL=-2: GOTO 590
580 ZL=VAL(A$)
590 ZM=(ZU-ZL)/140:XM=(XU-XL)/200: YM=(YU-YL)/200
600 TX=0-XL:TY=0-YL:TZ= -80*ZM - ZL: RETURN
610 K=(X+TX)/XM*C:Y=YL:GOSUB 640:U=I:V=J: RETURN
620 X=XL:K=(X+TX)/XM*C:GOSUB 640:U=I:V=J:RETURN
630 REM STATEMENT 640 CONTAINS THE FUNCTION TO BE PLOTTED
640 Z=SIN(X) + SIN(Y)
650 I=OX+(Y+TY)/YM - K:J=OY-(Z+TZ)/ZM+K: IF I< 0 THEN I=0
660 IF I > 279 THEN I=279
670 IF J > 191 THEN J=191
680 IF J< 0 THEN J=0
690 RETURN
700 IF (U=0 AND I=0) OR (U=279 AND I=279) OR (V=0 AND J=0) OR (J=191 AND V=191) THEN U=I:V=J: RETURN
710 draw (U,V to I,J):U=I:V=J:RETURN